/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package jas.http.server;

import jas.http.logging.DateRequestLineResponseCodeIPHttpLogger;
import jas.http.logging.HttpLogger;
import jas.http.response.HttpResponseFactory;
import jas.http.response.HttpResponseFactoryImpl;

/**
 *
 * @author Steff
 */
public class StdHttpServerFactory implements HttpServerFactory {
    private HttpLogger logger;
    private HttpResponseFactory factory;
    
    public StdHttpServerFactory() {
        logger = null;
        factory = new HttpResponseFactoryImpl("web", "DOOM WebServer Alpha");
    }
    public StdHttpServerFactory(HttpResponseFactory factory) {
        logger = null;
        this.factory = factory;
    }
    
    public int getListenPort() {
        return 8080;
    }

    public HttpLogger createLogger() {
        if (logger == null)
            logger = new DateRequestLineResponseCodeIPHttpLogger(System.out, System.err);
        return logger;
    }

    public ConnectionHandler createConnectionHandler() {
        return new ThreadedConnectionHandler(factory, createLogger());
    }
}
